import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.Arrays;
import java.util.List;

import static java.lang.Thread.sleep;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver = new ChromeDriver();

        webDriver.get("https://www.baidu.com");
        WebElement input=webDriver.findElement(By.cssSelector("#kw"));
        input.sendKeys("软件测试");
        WebElement button=webDriver.findElement(By.cssSelector("#su"));
        button.click();
        sleep(3000);
        List<WebElement> ret=webDriver.findElements(By.cssSelector("a em"));
        for (int i=0;i<ret.size();i++){
            if(ret.get(i).getText().equals("软件测试")){
                System.out.println("测试通过");
            }else{
                System.out.println("测试通过");
            }
        }
        webDriver.quit();


    }

}
